package com.np.demo1;

public class StringDemo1 {
    /**
     * siEmpty() 和 isBlank()
     * java11 才有 isBlank()
     */
    private void test1(){
        boolean b1 = false;

        String s1 = null;
        //b1 = s1.isEmpty();  // 报错
        //b1 = s1.isBlank();  // 报错

        s1 = "";
        b1 = s1.isEmpty();  // true
        b1 = s1.isBlank();  // true

        s1 = " ";
        b1 = s1.isEmpty();  // false
        b1 = s1.isBlank();  // true
        //endregion

        String s2 = "    a b     ".trim();
    }
}
